stubdom: fix a race that affects live migration with stubdoms
authorKeir Fraser <keir.fraser@citrix.com>
Wed, 8 Jul 2009 09:51:00 +0000 (10:51 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Wed, 8 Jul 2009 09:51:00 +0000 (10:51 +0100)
This patch fixes a race during live migration with stubdoms: right
after the stubdom dies the configuration file of the VM is removed by
stubdom-dm but, in case of a live migration, the configuration file
could be the one of the new VM in the process of being created.
Removing the config file before destroying the stubdom is enough to
solve the race.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
stubdom/stubdom-dm

index 76068a0bd0b2d680507250b36d936e5791b671f9..06b29e5b3fda916729dae6ba9be1e55d54010026 100644 (file)
@@ -82,8 +82,8 @@ term() {
     kill %1
     (
        [ -n "$vncpid" ] && kill -9 $vncpid
+       rm ${stubdom_configdir}/$domname-dm
        xm destroy $domname-dm
-        rm ${stubdom_configdir}/$domname-dm
     ) &
     # We need to exit immediately so as to let xend do the commands above
     exit 0